﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using SQLHelper;

public partial class admin_News_Read : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        bind();

    }

    void bind()
    {
        int UserID = Master.UserID;
        int id = Convert.ToInt32(Request["read"]);
        string sql = "select * from news where id = " + id + " and user_id = " + UserID;
        SqlDataReader res = DB.GetDataWithQuery(sql);
        if (res.Read()){
            string[] li = new string[6] { "id", "title", "source", "column_name", "created_at", "contents" };
            Label1.Text= Convert.ToString(res[li[1]]);
            Label2.Text = Convert.ToString(res[li[2]]);
            Label3.Text = Convert.ToString(res[li[3]]);
            Label4.Text = Convert.ToString(res[li[4]]);
            Label5.Text = Convert.ToString(res[li[5]]);
            DB.ColseSqlCon();
        }
    }
}